package com.fy.fyai.common.enums;

import lombok.Getter;

@Getter
public enum AiChatConversationStatusEnum {
    ACTIVE(1, "活跃"),
    ARCHIVED(2, "归档"),
    LOGICAL_DELETED(3, "逻辑删除");

    private final Integer code;
    private final String info;

    AiChatConversationStatusEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    /**
     * 根据code获取对应的枚举
     * @param code 状态编码
     * @return 对应的枚举，若未找到则返回null
     */
    public static AiChatConversationStatusEnum getByCode(Integer code) {
        for (AiChatConversationStatusEnum status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 根据info获取对应的枚举
     * @param info 状态描述
     * @return 对应的枚举，若未找到则返回null
     */
    public static AiChatConversationStatusEnum getByInfo(String info) {
        for (AiChatConversationStatusEnum status : values()) {
            if (status.info.equals(info)) {
                return status;
            }
        }
        return null;
    }
}